package com.example.invoke.dao;

import com.example.invoke.dto.TopMovie;
import com.example.invoke.dto.TopRateMovie;
import com.example.invoke.model.Movie;
import com.example.invoke.model.MovieExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository(value = "movieMapper")
public interface MovieMapper {
    @Select(value = "select title,rate from movie ORDER BY rate DESC LIMIT 7")
    List<TopRateMovie> initHead();

    @Select(value = "select cover_url coverUrl,url,title,director from movie ORDER BY ctime DESC")
    List<TopMovie> movies();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int countByExample(MovieExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int deleteByExample(MovieExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int insert(Movie record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int insertSelective(Movie record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    List<Movie> selectByExample(MovieExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    Movie selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int updateByExampleSelective(@Param("record") Movie record, @Param("example") MovieExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int updateByExample(@Param("record") Movie record, @Param("example") MovieExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int updateByPrimaryKeySelective(Movie record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table movie
     *
     * @mbggenerated Fri Oct 26 14:23:43 CST 2018
     */
    int updateByPrimaryKey(Movie record);
}